package com.qilu.pe.ui.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.qilu.pe.R;
import com.qilu.pe.base.Config;
import com.qilu.pe.dao.bean.Article;
import com.qilu.pe.support.util.GlideUtil;
import com.ruitu.arad.base.base_list.ListBaseAdapter;
import com.ruitu.arad.base.base_list.SuperViewHolder;

// 精选文章
public class ArticleAapter extends ListBaseAdapter<Article> {

    public ArticleAapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_article_list;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        TextView tv_name = holder.getView(R.id.tv_name);
        TextView tv_content = holder.getView(R.id.tv_content);
        TextView tv_time = holder.getView(R.id.tv_time);
        ImageView iv_image = holder.getView(R.id.iv_image);

        Article a = mDataList.get(position);
        tv_name.setText(a.getName());
        tv_content.setText(a.getIntroduction());
        tv_time.setText(a.getCreated_at());
        GlideUtil.loadImg(Config.URL_IMG + a.getPicture(), iv_image);
    }
}